package club.lovety.code.thread.demo;

/**
 * <p>
 * 这里写有象视频代码描述
 * </p>
 *
 * @author sunmc
 * @date created in 2018/4/25 11:36
 * @since
 */
public class ThreadGroupDemo {


    public static void main(String[] args) {
        ThreadGroup threadGroup = new ThreadGroup("统一线程组");


        for(int index=0 ;index<5;index++){
            new Thread(threadGroup,()->{
                try {
                    Thread.sleep(1000L);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            },"thread-"+index).start();
        }


        int activeGroupCount = threadGroup.activeGroupCount();

        System.out.println("ac: "+ activeGroupCount);
        int activeCount= threadGroup.activeCount();
        System.out.println("acv: "+ activeCount);
    }
}
